<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/11/26
 * Time: 16:09
 */
namespace app\portal\command;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\Db;

class ClearPoints extends Command
{
    protected function configure(){
        $this->setName('ClearPoints')->setDescription("每年开始清空可用积分");
    }

    protected function execute(Input $input, Output $output)
    {
        $result=[];
        try{
            Db::query('update cmf_user_rank set can_points = 0;');
            $result["error"]= false;
            $result['msg']='success';
        }catch (\Exception $e){
            $result["error"]= true;
            $result['msg']= $e->getMessage();
        }
        return json($result);
        //parent::execute($input, $output);
    }
}